﻿'Concrete Iterator
Public Class IteratorConcreto(Of T)
    Implements Iterator(Of T)

    Private _vector As T()
    Private _posicion As Integer = -1

    Sub New(libros As T())
        _vector = libros
    End Sub

    Public ReadOnly Property Current As T Implements Iterator(Of T).Current
        Get
            Return _vector(_posicion)
        End Get
    End Property

    Public Function MoveNext() As Boolean Implements Iterator(Of T).MoveNext
        If _posicion < _vector.Length - 1 Then
            _posicion = _posicion + 1

            Return True
        Else
            Return False
        End If
    End Function

    Public Sub Reset() Implements Iterator(Of T).Reset
        _posicion = -1
    End Sub

End Class
